<!DOCTYPE HTML>
<html>
<head>
<title>关于我 </title>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="images/favicon.ico" >
<LINK rel="Shortcut Icon" href="images/favicon.ico" />

<link rel="stylesheet" type="text/css" href="plugin/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="plugin/Hui-iconfont/1.0.8/iconfont.min.css" />
<link rel="stylesheet" type="text/css" href="css/commons.css" />
<link rel="stylesheet" type="text/css" href="plugin/pifu/pifu.css" />
    <script src="js/jquery-3.3.1.min.js"></script>
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } function showSide(){$('.navbar-nav').toggle();}</script>
    <script>
        $(function () {
            //查询是否登录
            $.ajax({
                url:"/CustomersSession",
                type:"post",
                dataType:"text",
                data:"",
                success:function (data) {
                    if(data!=""&&data!=null)
                    {
                        $("#login").text(data);
                    }
                },
                error:function (data) {
                    console.log("错误"+data.status);
                }
            });
            //登录
            $("#login").click(function () {
                if ($(this).text() === "未登录") {
                    location.href = "/login.html";
                } else {
                    //个人中心
                    //alert($(this).text());
                    $("#modal-demo").modal("show")
                }
            });
            //加载时先绑定用户信息
            $.ajax({
                url: "/SelectUserName",
                type: "post",
                dataType: "json",
                data: "",
                success: function (data) {
                    console.log(data.name);
                    $("#User_Name").val(data.name);
                    $("#User_email").val(data.email);
                    $("#User_address").val(data.address);
                    $("#User_occupation").val(data.occupation);
                    $("#User_telephone").val(data.telephone);
                    $("input[type=radio][name=sex][value="+data.sex+"]").attr("checked", true);
                }, error: function (data) {
                    console.log("错误" + data.status);
                }
            });
        })
        //修改密码信息
        function fun() {
            if ($("#User_password").val() !== $("#User_NewPassword").val()) {
                $("#error").text("两次密码不一致");
                return;
            } else {
                $("#error").text("");


                if ($("#User_password").val() !== "") {
                    //保存修改密码
                    $.ajax({
                        url: "/UpdateUserPassword",
                        type: "post",
                        dataType: "text",
                        data: {
                            OriginalPassword: $("#User_Ypassword").val(),
                            NewPassword: $("#User_password").val()
                        },
                        success: function (data) {
                            if (data == "ok") {
                                // alert("密码修改成功，请重新登录");
                                //
                                UpdateUser();
                                //location.href = "/login.html";
                            } else {
                                $("#error").text(data.toString());
                                return;
                            }
                        },
                        error: function (data) {
                            alert("错误" + data.status);
                        }

                    });
                }else
                {
                    UpdateUser();
                }

            }

        };

        //修改信息
        function UpdateUser() {
            $.ajax({
                url: "/UpdateUser",
                type: "post",
                dataType: "text",
                data: {
                    name: $("#User_Name").val(),
                    sex: $('input:radio[name="sex"]:checked').val(),
                    email: $("#User_email").val(),
                    address: $("#User_address").val(),
                    occupation: $("#User_occupation").val(),
                    telephone: $("#User_telephone").val()
                },
                success: function (data) {
                    if (data === "ok") {
                        alert("修改成功");
                        $("#modal-demo").modal("hide");
                        $("#User_Ypassword").val("")
                        $("#User_password").val("")
                        $("#User_NewPassword").val("")

                    } else {
                        $("#error").text(data.toString());
                    }
                },
                error: function (data) {
                    alert("错误" + data.status);
                }

            });
        }

    </script>
</head>
<body>
<header class="navbar-wrapper">
    <div class="navbar navbar-fixed-top">
        <div class="container cl">
            <a class="navbar-logo hidden-xs" href="index.html">
                <img class="logo" src="images/logo.png" alt="博客" />
            </a>
            <a class="logo navbar-logo-m visible-xs" href="index.html">博客</a>
            <a aria-hidden="false" class="nav-toggle Hui-iconfont visible-xs" href="javascript:void(0);" onclick="showSide();">&#xe667;</a>
            <nav class="nav navbar-nav nav-collapse w_menu" role="navigation">
                <ul class="cl">
                    <li class="active"> <a href="index.html" data-hover="首页">首页</a> </li>
                    <li> <a href="about.html" data-hover="关于我">关于我</a> </li>
                    <li> <a href="mood.html" data-hover="碎言碎语">碎言碎语</a> </li>
                    <li><a href="article.html" data-hover="学无止尽">学无止尽</a></li>
                    <li> <a href="board.html" data-hover="留言板">留言板</a> </li>
                </ul>
            </nav>
            <nav class="navbar-nav navbar-userbar hidden-xs hidden-sm " style="top: 0;">
                <ul class="cl">
                    <li class="userInfo dropDown dropDown_hover">
                            <!--<a href="javascript:;" ><img class="avatar radius" src="images/40.jpg" alt="丶似浅 "></a>
                            <ul class="dropDown-menu menu radius box-shadow">
                                <li><a href="/app/loginOut">退出</a></li>
                            </ul>-->
                        <a href="#" id="login">未登录</a>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
</header>

<!--导航条-->
<nav class="breadcrumb">
    <div class="container"> <i class="Hui-iconfont">&#xe67f;</i> <a href="index.html" class="c-primary">首页</a> <span class="c-gray en">&gt;</span>  <span class="c-gray">关于</span> </div>
</nav>

<section class="container">
    <div class="container-fluid">
        <div class="about">
            <h2>Just about me</h2>
            <ul>
                <p>一枚正在努力进步的javaWeb程序员。专长领域为Web开发、服务器端开发，目前正在向全栈工程师进发。。。</p>
            </ul>
            <h2>About my blog</h2>
            <ul>
                <p>域  名：zhuweirui.top 注册于2019年10月02日</p>
                <p>服务器：阿里云服务器 ，于2019年10月23日完成备案</p>
                <p>备案号：**********号</p>
                <p>本站定位为IT技术博客站，博客内容主要涉及编程语言、前端开发、服务端开发及一些热门技术等方面，同时分享实用的开发资料。</p>
            </ul>
            <h2>Contact  me</h2>
            <ul>
                <p><i class="Hui-iconfont">&#xe67b;</i>qq : *********暂不公开 : (</p>
                <p><i class="Hui-iconfont">&#xe6d1;</i>git：*********</p>
                <p><i class="Hui-iconfont">&#xe63b;</i>email : XXX</p>
            </ul>
        </div>

    </div>
</section>
<footer class="footer mt-20">
    <div class="container-fluid" id="foot">
        <p>Copyright &copy; 2020
            
        </p>
    </div>
</footer>

<div id="modal-demo" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content radius">
            <div class="modal-header">
                <h3 class="modal-title">修改个人信息</h3>
                <a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void(0);">×</a>
            </div>
            <div class="modal-body">
                <!--p>对话框内容…</p>-->
                <form action="" method="post" class="form form-horizontal" id="demoform-1">
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">昵称：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" class="input-text" autocomplete="off" placeholder="昵称" id="User_Name">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">性别：</label>
                        <div class="formControls skin-minimal col-xs-8 col-sm-9">
                            <div class="radio-box">
                                <input type="radio" id="sex-1" name="sex" value="1" checked>
                                <label for="sex-1">男</label>
                            </div>
                            <div class="radio-box">
                                <input type="radio" id="sex-0" name="sex" value="0">
                                <label for="sex-0">女</label>
                            </div>
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">邮箱：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" class="input-text" autocomplete="off" placeholder="邮箱" id="User_email">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">地址：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" class="input-text" autocomplete="off" placeholder="地址" id="User_address">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">职业：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" class="input-text" autocomplete="off" placeholder="职业"
                                   id="User_occupation">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">联系方式：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" class="input-text" autocomplete="off" placeholder="联系方式"
                                   id="User_telephone">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">原密码：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="password" class="input-text" autocomplete="off" placeholder="原密码"
                                   id="User_Ypassword">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">新密码：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="password" class="input-text" autocomplete="off" placeholder="新密码"
                                   id="User_password">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3">确认密码：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="password" class="input-text" autocomplete="off" placeholder="再次输入新密码"
                                   id="User_NewPassword">
                            <span style="color: red" id="error"></span>
                        </div>
                    </div>
                </form>

            </div>
            <div class="modal-footer">
                <button class="btn btn-primary" onclick="fun();">确定</button>
                <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="plugin/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="plugin/layer/3.0/layer.js"></script>
<script type="text/javascript" src="plugin/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="plugin/pifu/pifu.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script> $(function(){ $(window).on("scroll",backToTopFun); backToTopFun(); }); </script>
</body>
</html>
